//console.log("inject.js");

chrome.extension.sendRequest({msg: "lang"}, function(response) {
	var lang = response.lang;
	console.log("Init Chrome little dict: " + lang);
	
	var script = document.createElement('script');
	script.type="text/javascript";
	script.innerText = 'lang = "' + lang + '";';
	document.getElementsByTagName('head')[0].appendChild(script);
	
	var element = document.createElement('script');
	element.src = chrome.extension.getURL('dict.js');
	document.getElementsByTagName('head')[0].appendChild(element);
});